package com.dtwenty.gaming.client.widgets;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class D20Label extends Composite {
	private Label label;
	private Widget widget;
	private DockPanel panel = new DockPanel();
	
	public enum Position {LEFT, TOP, RIGHT, BOTTOM};
	
	public D20Label(String label, Widget widget, Position position) {
		this.initWidget(panel);
		
		this.label = new Label(label);
		this.label.setStylePrimaryName("D20LabelLabel");
		this.widget = widget;
		
		switch(position) {
		case BOTTOM:
			this.panel.add(this.label, DockPanel.SOUTH);
			break;
		case RIGHT:
			this.panel.add(this.label, DockPanel.EAST);
			break;
		case TOP:
			this.panel.add(this.label, DockPanel.NORTH);
			break;
		default: 
			this.panel.add(this.label, DockPanel.WEST);
			break;
		}
		this.panel.add(this.widget, DockPanel.CENTER);
		this.setStylePrimaryName("D20Label");
	}
	public D20Label(String label, Widget widget) {
		this(label, widget, Position.LEFT);
	}
	public D20Label(String label) {
		this(label, new Label(""));
	}
	public D20Label() {
		this("");
	}
}
